<template>
    <div class="app-container">
      <div class="header-bar">
        <a-input-search
          placeholder="可根据系统名称或者系统编码查询"
          style="width: 200px"
        />
  
        <div class="status-tabs">
          <a-button
            v-for="tab in statusTabs"
            :key="tab.value"
            :type="activeTab === tab.value ? 'primary' : 'default'"
            @click="activeTab = tab.value"
            size="middle"
          >
            {{ tab.label }}
          </a-button>
        </div>
  
        <div class="action-buttons">
          <a-button type="primary" size="middle">导入</a-button>
          <a-button size="middle">全量导出</a-button>
        </div>
      </div>
  
      <div class="system-card-list">
        <a-row :gutter="16">
          <a-col style="margin-bottom: 10px;"
            :xs="24"
            :sm="12"
            :md="8"
            :lg="6"
          >
            <a-card
              class="system-card"
              :class="{
                'new-system': '新建',
              }"
              :body-style="{ padding: '16px' }"
              hoverable
            >
              <div class="card-top-right">
               
                
              </div>
  
              <div class="card-icon">
                <component :is="PlusOutlined" :size="24" />
              </div>
  
              <div class="card-content">
                <h3 class="card-title">新建系统</h3>
                <p class="card-desc"></p>
                <p class="card-code"></p>
              </div>
            </a-card>
          </a-col>
          <a-col style="margin-bottom: 10px;"
            v-for="(system, index) in filteredSystems"
            :key="system.id || `system-${index}`"
            :xs="24"
            :sm="12"
            :md="8"
            :lg="6"
          >
            <a-card
              class="system-card"
              :class="{
                'new-system': system.status === '新建',
                'disabled-system': system.status === '已停用',
                'enabled-system': system.status === '已启用',
              }"
              :body-style="{ padding: '16px' }"
              hoverable
            >
              <div class="card-top-right">
                <div v-if="system.status !== '新建'" class="status-tag">
                  {{ system.status }}
                </div>
                <a-dropdown>
                  <a-button type="text" size="small" :icon="h(EllipsisOutlined)" />
                  <template #overlay>
                    <a-menu>
                      <a-menu-item key="edit">编辑</a-menu-item>
                      <a-menu-item key="delete">删除</a-menu-item>
                    </a-menu>
                  </template>
                </a-dropdown>
              </div>
  
              <div class="card-icon">
                <component :is="system.icon" :size="24" />
              </div>
  
              <div class="card-content">
                <h3 class="card-title">{{ system.name }}</h3>
                <p class="card-desc">{{ system.desc || '无描述' }}</p>
                <p class="card-code">系统编码 {{ system.code || '-' }}</p>
              </div>
            </a-card>
          </a-col>
        </a-row>
  
        <div v-if="filteredSystems.length === 0" style="text-align: center; padding: 48px;">
          <a-empty description="暂无匹配的系统数据" />
        </div>
      </div>
    </div>
  </template>
  
  <script setup>
  import { ref, computed, h } from 'vue';
  import {
    PauseCircleOutlined,
    CheckSquareOutlined,
    BuildOutlined,
    HomeOutlined,
    RocketOutlined,
    FileTextOutlined,
    PlusOutlined,
    EllipsisOutlined
  } from '@ant-design/icons-vue';
  
  const systemList = [
    {
      id: 1,
      name: 'Sap集成12',
      desc: 'qweqweq',
      code: 'sys_kzp362',
      status: '已停用',
      icon: PauseCircleOutlined
    },
    {
      id: 2,
      name: '用友U9管理系统',
      desc: '成长型企业互联网应用平台',
      code: 'U9',
      status: '已启用',
      icon: CheckSquareOutlined
    },
    {
      id: 3,
      name: '用友NC管理系统',
      desc: '企业应用集成平台—实现高效集成，无缝整合、低TCO企业级应用集成解决方案',
      code: 'sys_y7c9ot',
      status: '已启用',
      icon: BuildOutlined
    },
    {
      id: 4,
      name: 'Oracle ERP集成',
      desc: 'Oracle ERP集成以模块化形式提供，允许公司仅实施其所需的模块，以后需要的话再添加更多模块',
      code: 'sys_xa3nd7',
      status: '已启用',
      icon: HomeOutlined
    },
    {
      id: 5,
      name: '钉钉集成',
      desc: '通过钉钉开发的工作流接口，企业可以自定义自己的审批流程，自动与钉钉待办集成，实现业务高效流转',
      code: 'sys_29i1av',
      status: '已停用',
      icon: RocketOutlined
    },
    {
      id: 6,
      name: '采购系统集成',
      desc: 'SAP(思爱普)为全球企业管理解决方案的提供商,提供完善的ERP、云ERP、CRM、大数据、云计算、供应链、物联网解决方案',
      code: '121',
      status: '已启用',
      icon: FileTextOutlined
    },
    {
      id: 7,
      name: 'EKP系统',
      desc: '',
      code: 'sys_biat96',
      status: '已启用',
      icon: FileTextOutlined
    },
  ];
  
  const activeTab = ref('全部');
  const statusTabs = [
    { label: '全部', value: '全部' },
    { label: '已启用', value: '已启用' },
    { label: '已停用', value: '已停用' },
  ];
  
  const filteredSystems = computed(() => {
    if (activeTab.value === '全部') {
      return [...systemList];
    }
    return systemList.filter(item => item.status === activeTab.value);
  });
  </script>
  
  <style scoped>
  .app-container {
    min-height: 100vh;
    background: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
  }
  
  .header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e8e8e8;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .status-tabs {
    display: flex;
    gap: 8px;
    margin: 0;
  }
  
  .action-buttons {
    display: flex;
    gap: 8px;
    margin: auto;
  }
  
  .system-card-list {
    padding: 24px;
  }
  
  .system-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative; 
    padding-bottom: 5px;
  }
  
  .system-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
  }
  
  .card-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 1;
  }
  
  .status-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    font-weight: 500;
  }
  
  .card-icon {
    border: 1px dashed #d9d9d9;
    color: #1890ff;
    background: rgba(24, 144, 255, 0.05);
  }
  
  .disabled-system .status-tag {
    background: #fff1f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
  }
  
  .enabled-system .status-tag {
    background: #f0f9eb;
    color: #52c41a;
    border: 1px solid #c3e6be;
  }
  
  .card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin: 0 0 16px 0;
  }

  .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
    line-height: 1.4;
    margin-top: 0;
  }
  
  .card-desc {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    margin-top: 0;
  }
  
  .card-code {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.4;
    position: absolute;
    bottom: 5px;
    left: 16px;
    z-index: 1;
  }
  
  @media (max-width: 1200px) {
    .system-card-list {
      padding: 16px;
    }
  }
  
  @media (max-width: 768px) {
    .header-bar {
      padding: 12px 16px;
    }
    .status-tabs {
      order: 3;
      width: 100%;
      justify-content: flex-start;
      overflow-x: auto;
      padding-bottom: 8px;
    }
  }
  
  @media (max-width: 480px) {
    .ant-input-search {
      width: 100% !important;
    }
    .action-buttons {
      width: 100%;
      justify-content: space-between;
    }
  }
  </style>
  
  <style>
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  </style>